LLD Interview Cheat Sheet
๐ The 6-Step Template (45-60 min Interview)โ
| Step | Time | Focus | Key Actions |
|---|---|---|---|
| 1๏ธโฃ Requirements | 8-10 min | ๐ฅ CRITICAL | Ask questions, clarify scope |
| 2๏ธโฃ Entities & Relations | 8-10 min | ๐ฅ CRITICAL | Find nouns, define relationships |
| 3๏ธโฃ Class Design | 10-12 min | ๐ฅ CRITICAL | Attributes + responsibilities |
| 4๏ธโฃ Interface Definition | 6-8 min | ๐จ HIGH | Method signatures + contracts |
| 5๏ธโฃ Implementation | 12-15 min | ๐จ HIGH | Skeleton code, OOP principles |
| 6๏ธโฃ Edge Cases | 5-8 min | โก MEDIUM | Failures + extensions |
1๏ธโฃ Requirements Clarification (8-10 min)โ
โ Questions to Ask:โ
๐ FUNCTIONAL:
- What are the core features?
- Who are the users?
- What operations are needed?
- Any specific business rules?
๐ NON-FUNCTIONAL:
- How many users/requests?
- Performance requirements?
- Consistency vs Availability?
- Storage constraints?
๐ SCOPE:
- What's included/excluded?
- Mobile app needed?
- Payment integration?
- Real-time updates?
๐ฏ Output: Clear requirements listโ
2๏ธโฃ Core Entities & Relationships (8-10 min)โ
โ Find Nouns (Classes):โ
Example: "Park vehicle in parking lot, generate ticket"
โ Vehicle, ParkingLot, ParkingSlot, Ticket
โ Define Relationships:โ
IS-A (Inheritance): Car IS-A Vehicle
HAS-A (Composition): ParkingLot HAS-A List<Slot>
USES-A (Association): Ticket USES Vehicle + Slot
๐จ Abstract vs Interface Decision:โ
- Abstract: Shared attributes + some behavior (Vehicle โ Car, Bike)
- Interface: Contract/capability (Payable, Notifiable)
3๏ธโฃ Class Design (10-12 min) - MOST CRITICALโ
โ For Each Class Define:โ
Class Name
โโโ Attributes (private/protected)
โโโ Responsibilities (what it does)
โโโ Key methods (public interface)
โโโ Relationships to other classes
๐ฏ OOP Principles Checklist:โ
- โ Encapsulation: Private fields, public getters/setters
- โ Inheritance: Proper IS-A relationships
- โ Polymorphism: Abstract methods, overriding
- โ Abstraction: Hide complex implementation
๐จ Design Principles (SOLID):โ
- Single Responsibility: One class, one job
- Open/Closed: Open for extension, closed for modification
- Liskov Substitution: Subclasses should be replaceable
- Interface Segregation: Small, focused interfaces
- Dependency Inversion: Depend on abstractions
4๏ธโฃ Interface Definition (6-8 min)โ
โ Define Method Contracts:โ
public interface ParkingSystem {
ParkingTicket parkVehicle(Vehicle vehicle) throws NoSlotException;
boolean unparkVehicle(String ticketId) throws InvalidTicketException;
int getAvailableSlots(VehicleType type);
double calculateFee(String ticketId);
}
๐ฏ Method Design Tips:โ
- Clear method names (no ambiguity)
- Proper return types
- Exception handling strategy
- Parameter validation
5๏ธโฃ Implementation (12-15 min)โ
โ Code Structure Priority:โ
- Core classes first (2-3 main classes)
- Key methods only (not all getters/setters)
- Main controller/manager class
- Basic logic (don't perfect syntax)
๐ฏ What to Show in Code:โ
// โ
Show inheritance
abstract class Vehicle {
protected String id;
public abstract VehicleType getType();
}
// โ
Show composition
class ParkingLot {
private List<ParkingSlot> slots;
private Map<String, Ticket> tickets;
}
// โ
Show polymorphism
public ParkingTicket parkVehicle(Vehicle vehicle) {
// Different logic based on vehicle.getType()
}
๐จ Quick Implementation Tips:โ
- Use enums for constants (VehicleType, SlotType)
- Collections for storage (List, Map, Set)
- Exception handling (custom exceptions)
- Basic validation logic
6๏ธโฃ Edge Cases & Extensions (5-8 min)โ
โ Common Edge Cases:โ
๐จ FAILURE SCENARIOS:
- No available slots
- Invalid ticket/ID
- Duplicate operations
- Concurrent access issues
- Invalid input data
๐ก VALIDATIONS:
- Null checks
- Range validations
- State validations
- Business rule violations
โ Design Patterns (Mention if Time):โ
๐ฏ COMMON PATTERNS:
- Factory: Creating vehicles/slots
- Singleton: ParkingLot instance
- Strategy: Different pricing strategies
- Observer: Notify on slot availability
- Command: Parking operations
- State: Slot states (occupied/free)
โ Scaling Considerations:โ
๐ SCALABILITY:
- Database persistence
- Caching (Redis)
- Load balancing
- Microservices
- Event-driven architecture
- Thread safety (synchronized, locks)
โฐ Time Management Checkpointsโ
| Time | Checkpoint | If Behind |
|---|---|---|
| 15 min | Requirements + Entities done | Skip some clarifying questions |
| 25 min | Class design complete | Combine class design + interfaces |
| 40 min | Core implementation done | Show skeleton only |
| 50 min | Edge cases discussed | Quick summary of extensions |
๐ฏ Interview Success Formulaโ
๐ข Communication Tips:โ
๐ฃ๏ธ SPEAK YOUR THOUGHT PROCESS:
- "Let me clarify the requirements first..."
- "I see three main entities here..."
- "I'm running short on time, so I'll focus on..."
- "This is how I'd handle this edge case..."
๐ฏ Prioritization Strategy:โ
HIGH IMPACT:
โ
Complete requirements understanding
โ
Clean OOP design
โ
Working core implementation
โ
Clear communication
MEDIUM IMPACT:
โก Interface contracts
โก Edge case handling
โก Design patterns mention
LOW IMPACT:
๐น Perfect syntax
๐น Complete implementation
๐น Advanced scalability discussion
๐จ Common Mistakes to Avoidโ
| โ DON'T | โ DO |
|---|---|
| Spend 20+ min on requirements | 8-10 min max, then move |
| Perfect code syntax | Focus on structure & logic |
| Implement every method | Show key methods, mention others |
| Over-engineer with patterns | Simple design first |
| Silent coding | Explain your thinking |
| Jump to code immediately | Design first, code later |
๐ Common LLD Problems Prepโ
๐ฏ Must Practice:โ
- Parking Lot System โญโญโญ
- Chess Game โญโญโญ
- ATM System โญโญ
- Elevator System โญโญ
- Hotel Booking System โญโญ
- Library Management โญ
- Restaurant Management โญ
- Online Shopping Cart โญ
๐ Pattern Recognition:โ
- Booking Systems: Hotel, Flight, Movie โ Similar entities (Room, Seat, User, Booking)
- Game Systems: Chess, Tic-tac-toe, Snake โ Board, Player, Game state
- Management Systems: Library, Hospital, School โ Person, Resource, Transaction
๐ Final Checklist Before Interviewโ
โก Practice 2-3 LLD problems using this template
โก Review OOP principles & SOLID
โก Practice explaining design decisions
โก Time yourself (45-60 min practice)
โก Prepare clarifying questions for any LLD
โก Review common design patterns
โก Practice whiteboard/drawing skills
โก Prepare for follow-up scaling questions
๐ก Last Minute Tipsโ
๐ฏ Show Problem-Solving Approach:โ
- Think out loud
- Ask clarifying questions
- Start simple, add complexity
- Trade-offs discussion
- Clean, readable code structure
๐ฃ๏ธ Sample Phrases to Use:โ
- "Let me clarify the requirements..."
- "I see this as an inheritance vs composition decision..."
- "For scalability, we could consider..."
- "The trade-off here is..."
- "Given time constraints, I'll focus on..."
๐ Confidence Boosters:โ
- You know OOP principles โ
- You understand design patterns โ
- You can write clean code โ
- You can explain your thinking โ
- You've practiced this template โ
Remember: Perfect solution < Complete working solution with good design! ๐ฏ
๐ Good luck with your interview! Stay calm, follow the template, and show your problem-solving skills.